473,467 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Writing javascript for dropdownlist selectedIndexChange



Hello,

I have a dropdownlist server control.On selectedIndexChange I do some
functionality. In addtion to this I need to check for something else. To
do this I have to use javascript function to display confirmation alert.
How can I use the javascript confirmation alert in code behind?

any help?

Thanks
Mangala Bhat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 5060
You can execute a line of code like this when you want a message box to be
displayed.
(This writes out the necessary client side javascript to your HTML page to
make the alert pop up as soon as the page is sent to their browser.)

RegisterStartupScript("startupScript", "<script
language=JavaScript>alert('This is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"MBhat" <ma*****@devx.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl...


Hello,

I have a dropdownlist server control.On selectedIndexChange I do some
functionality. In addtion to this I need to check for something else. To
do this I have to use javascript function to display confirmation alert.
How can I use the javascript confirmation alert in code behind?

any help?

Thanks
Mangala Bhat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

Hello,

Let me be more clear about my problem.

I have a dropdownlist server control. I have written SelectedIndexChange
method for this. Now I also need to write a javascript function which
has a confirmation message in it for the same SelectedIndexChange
method.

I wrote it like this
mDrpCounties.Attributes.Add("onchange", "CheckAlert();")

I noticed one thing here..The first time when the selectedIndexChange
method is called the javascript doesn't fire. but the second time when
its done, javascript fires.

Why is that??? Can you tell me??

I tried to do RegisterStartupScript,RegisterClientScriptBlock but
nothing is working.

Thanks
MBhat
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul C | last post by:
Can anyone tell me why I am getting 2 calls to my SelectedIndexChange event. public class Browse : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid DataGrid1; protected...
3
by: Paraki | last post by:
Hi, I have 4 items in a dropdownlist. After selecting the item the dropdownlist gets disabled. this operation is performed in selectedIndexChangeCommited event. Now the problem is, I hignlight...
1
by: Jay | last post by:
I have dropdownlist in a usercontrol and selectedindexchange event captured. But Iam seeing fire twice. Thanks.
1
by: Ravi | last post by:
I am trying to represent master-detail records from a database The general logic will be populating the first dropdownlist with the master records and on change of the first dropdownlis getting...
1
by: ProSAAP | last post by:
I need help. I am attaching both the html stuff as well as the code snippet that is not firing. Can someone please help me Thank Sub InputPub_SelectedIndexChanged(ByVal sender As Object, ByVal e...
4
by: Yahya Saad | last post by:
Dear All, I have an ASP.Net webform that includes a DropDownList (bound to a dataview including 6000 records) and a textbox that is updated according to the selection of an event at the...
2
by: Kevin | last post by:
Hi I need to get the "ItemId" from the selected value of the DropDownList in a DataList, but i don't known where tu put the <%# DataBinder.Eval(Container.DataItem, "ItemId"), because if I try to...
3
by: Kim | last post by:
I have a user control with 3 dropdownlist when a user selects the first listbox based on his/her selection the 2 listbox will load based off the users selection from the 2nd listbox the 3rd listbox...
1
by: affi | last post by:
Hi all, I m new to javascript and web development for that matter, so, my questions may sound dumb...........but i will really apperciate any solution ASAP as i m facing a deadline............ ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.